DEMO.TXT for Printer Status Demo Ver 1.0 Copyright(c) by Gregory H.Bragg October, 1995 The Printer Status Demo consists of two files, PRINTSTT.EXE and PRNTSTAT.DLL. The demo calling application, PRINTSTT.EXE, was written in Visual Basic Ver 3.0 and the file that does all the work, PRNTSTAT.DLL, was written in Borland C++ Ver 4.5. The demo DLL is not crippled in any way other than the beg screens displayed at the beginning and at the end of program execution. PRNTSTAT.DLL can be placed in the application directory, the Windows directory or in the Windows\System directory... although the latter is the preferred location. When the demo is first started it searches WIN.INI for the location of the default installed printer. From this info it is then able to check the status of the printer by accessing PRNTSTAT.DLL. The seven functions in PRNTSTAT.DLL call a General 8086 software interrupt to retrieve six status bits relating to the current printer status. Being a low level function call it would be impossible to duplicate this using VB 3.0. Although the main code that calls the interrupt is 16 bits it is fully compatible with Windows 3.1, Windows 3.11 and Windows 95. Use with Windows NT is unknown and untested but I would be interested in any information regarding the demo used in this OS as I don't have access to Windows NT. I have written VB 3.0 applications while using Windows 3.1 and Windows 95 that access PRNTSTAT.DLL with no problems. To access PRNTSTAT.DLL in Visual Basic, place the following declarations into any code module... Declare Function GetTimeoutStatus Lib "PRNTSTAT.DLL" (ByVal PortNo As Integer) As Integer Declare Function GetPaperStatus Lib "PRNTSTAT.DLL" (ByVal PortNo As Integer) As Integer Declare Function GetOnlineStatus Lib "PRNTSTAT.DLL" (ByVal PortNo As Integer) As Integer Declare Function GetErrorStatus Lib "PRNTSTAT.DLL" (ByVal PortNo As Integer) As Integer Declare Function GetBusyStatus Lib "PRNTSTAT.DLL" (ByVal PortNo As Integer) As Integer Declare Function GetAcknowledgeStatus Lib "PRNTSTAT.DLL" (ByVal PortNo As Integer) As Integer Declare Function GetReadyStatus Lib "PRNTSTAT.DLL" (ByVal PortNo As Integer) As Integer Where "PortNo" is the number of the port that the printer to be checked is connected to, ie. 1 (as in LPT:1). The integer returns from each function are 0, 1 and the default 9, (printer not available). Depending on the function type, the return value will relate to the current printer status when the function is called. See the example VB code for the Printer Status Demo. It is heavily commented and will get you started in accessing PRNTSTAT.DLL. You are allowed to copy, modify or paste any of this code into your own projects to access PRNTSTAT.DLL. The function prototypes for C or C++ are as follows: int FAR PASCAL GetTimeoutStatus(unsigned portid); int FAR PASCAL GetPaperStatus(unsigned portid); int FAR PASCAL GetOnlineStatus(unsigned portid); int FAR PASCAL GetErrorStatus(unsigned portid); int FAR PASCAL GetBusyStatus(unsigned portid); int FAR PASCAL GetAcknowledgeStatus(unsigned portid); int FAR PASCAL GetReadyStatus(unsigned portid); PRNTSTAT.DLL can also be used with other programming environments with a minimum modification of calling convention. It is very simple to access the dll in any programming language. For any comments, problems or suggestions please E-Mail me at 75027,2674 or read the README.TXT file for more contact info. Gregory Bragg October 17, 1995 Windows 3.1, Windows 3.11, Windows 95, Windows NT and Visual Basic 3.0 are Copyrights and Trademarks of Microsoft Corporation. Borland C++ 4.5 is Copyright and Trademark of Borland International.